Package i2p :: Module samclasses :: Class Stream
[show private | hide private]
[frames | no frames]

Class Stream


Receives and sends data for an individual stream.
Method Summary
  __init__(self, parent, remotedest, id, didconnect)
  __del__(self)
  __len__(self)
Current length of read buffer.
  close(self)
Close the stream.
  on_close(self, e)
  on_receive(self, s)
  recv(self, n, timeout, peek, waitall)
Reads up to n bytes in a manner identical to socket.recv.
  send(self, s)
Sends the string s, blocking if necessary.

Method Details

__len__(self)
(Length operator)

Current length of read buffer.

close(self)

Close the stream. Threadsafe.

recv(self, n, timeout=None, peek=False, waitall=False)

Reads up to n bytes in a manner identical to socket.recv. Blocks for up to timeout seconds if n > 0 and no data is available (timeout=None means wait forever). If still no data is available, raises BlockError or Timeout. For a closed stream, recv will read the data stored in the buffer until EOF, at which point the read data will be truncated. If peek is True, the data is not removed. If waitall is True, reads exactly n bytes, or raises BlockError or Timeout as appropriate. Returns data.

send(self, s)

Sends the string s, blocking if necessary.

Generated by Epydoc 2.1 on Mon Aug 02 01:07:41 2004 http://epydoc.sf.net